/**
 * Package Name:cn.com.guodiantong.common.service
 * Date:2017年8月14日 下午4:11:25
 * Copyright (c) 2017 mr.luoxing@gmail.com Rights Reserved.
 *
 */

package cn.com.guodiantong.common.service;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.github.pagehelper.ISelect;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import cn.com.guodiantong.common.api.domain.LoggerModel;
import cn.com.guodiantong.common.api.service.ILoggerService;
import cn.com.guodiantong.mapper.LoggerMapper;

/**
 * @ClassName: LoggerService.<br/>
 * @Description: TODO(实现提供服务方提供的接口).<br/>
 *
 * @author Mr.Luoxing
 * @version 1.0.0
 */
public class LoggerService implements ILoggerService{

	@Autowired
	LoggerMapper mapper;
	
	@Override
	public boolean save(LoggerModel model) {
		return mapper.insert(model) == 1;
	}

	@Override
	public List<Object> list(HashMap<String, Object> param) {
		PageInfo<Object> pageInfo = PageHelper.startPage(1,10).doSelectPage(new ISelect() {
			@Override
			public void doSelect() {
				mapper.list(param);
			}
		}).toPageInfo();
		List<Object> list = pageInfo.getList();
		return list;
	}

	@Override
	public HashMap<String, Object> selectByPrimaryKey(String id) {
		return mapper.selectByPrimaryKey(id);
	}

}

